function getI18nMsg(key) {
    try {
        return chrome.i18n.getMessage(key);
    } catch(err) {
        return key;
    }
};

function getMaxZindex(o) {
    var maxZindex = 0;
    var oSiblings = o.siblings();
    if (oSiblings.length > 0) {
        for (var i = 0; i < oSiblings.length; i++) {
            if (maxZindex < parseInt($(oSiblings[i]).css("z-index"))) {
                maxZindex = parseInt($(oSiblings[i]).css("z-index"));
            }
        }
    }
    return maxZindex;
};

function loadScript(src, fn) {
    fn = fn ||
    function() {};
    var obj = document.createElement("script");
    obj.type = "text/javascript";
    obj.setAttribute("load_type", "js");
    obj.setAttribute("charset", "utf-8");
    obj.src = src;
    obj.charset = 'utf-8';
    document.getElementsByTagName("head").item(0).appendChild(obj);
    if (obj.readyState) {
        if (obj.complete) {
            fn()
        } else {
            obj.onreadystatechange = function() {
                if (obj.readyState == "complete" || obj.readyState == "loaded") {
                    fn()

                }
            }
        }
    } else {
        obj.onload = function() {
            fn()
        }
    }
    obj.onerror = function() {
        alert(src + ' -- load error !')
    }
}